<!DOCTYPE html>





<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 3.9.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.4.0">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=7.4.0">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=7.4.0">
  <link rel="mask-icon" href="/images/logo.svg?v=7.4.0" color="#222">

<link rel="stylesheet" href="/css/main.css?v=7.4.0">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.7.0">


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '7.4.0',
    exturl: false,
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false},
    copycode: {"enable":false,"show_result":false,"style":null},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
    bookmark: {"enable":false,"color":"#222","save":"auto"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: '',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    translation: {
      copy_button: '复制',
      copy_success: '复制成功',
      copy_failure: '复制失败'
    },
    sidebarPadding: 40
  };
</script>


<script data-ad-client="ca-pub-8048531516491146" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

  <meta name="description" content="一、迁移过程迁移过程网上有很多现成的文章，这里主要参考巧叔的 从 Octopress 迁移到 Hexo 安装 Hexo先使用以下命令安装 Hexo： 1$ npm install hexo-cli -g  创建新的博客目录123$ hexo init &amp;lt;hexo root folder&amp;gt;$ cd &amp;lt;hexo root folder&amp;gt;$ npm install">
<meta name="keywords" content="Octopress,hexo">
<meta property="og:type" content="article">
<meta property="og:title" content="Octopress 迁移 Hexo 经验总结">
<meta property="og:url" content="http://foogry.org/2019/09/24/博客从-Octopress-迁移到-Hexo-经验总结/index.html">
<meta property="og:site_name" content="foogry的技术博客">
<meta property="og:description" content="一、迁移过程迁移过程网上有很多现成的文章，这里主要参考巧叔的 从 Octopress 迁移到 Hexo 安装 Hexo先使用以下命令安装 Hexo： 1$ npm install hexo-cli -g  创建新的博客目录123$ hexo init &amp;lt;hexo root folder&amp;gt;$ cd &amp;lt;hexo root folder&amp;gt;$ npm install">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2020-02-18T13:46:54.906Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Octopress 迁移 Hexo 经验总结">
<meta name="twitter:description" content="一、迁移过程迁移过程网上有很多现成的文章，这里主要参考巧叔的 从 Octopress 迁移到 Hexo 安装 Hexo先使用以下命令安装 Hexo： 1$ npm install hexo-cli -g  创建新的博客目录123$ hexo init &amp;lt;hexo root folder&amp;gt;$ cd &amp;lt;hexo root folder&amp;gt;$ npm install">
  <link rel="canonical" href="http://foogry.org/2019/09/24/博客从-Octopress-迁移到-Hexo-经验总结/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>

  <title>Octopress 迁移 Hexo 经验总结 | foogry的技术博客</title>
  


  <script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?2944231de73b405a5da5c6b4097cfa0e";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">
  <div class="container use-motion">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-meta">

    <div>
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">foogry的技术博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <h1 class="site-subtitle" itemprop="description">Stay hungry,stay foolish.</h1>
      
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
      
      
      
        
        <li class="menu-item menu-item-home">
      
    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-archives">
      
    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-about">
      
    

    <a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>

  </li>
  </ul>

</nav>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
            

          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
      <article itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block post">
    <link itemprop="mainEntityOfPage" href="http://foogry.org/2019/09/24/博客从-Octopress-迁移到-Hexo-经验总结/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="foogry">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="foogry的技术博客">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">Octopress 迁移 Hexo 经验总结

          
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              
                
              

              <time title="创建时间：2019-09-24 20:30:23" itemprop="dateCreated datePublished" datetime="2019-09-24T20:30:23+08:00">2019-09-24</time>
            </span>
          
            

            
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-02-18 21:46:54" itemprop="dateModified" datetime="2020-02-18T21:46:54+08:00">2020-02-18</time>
              </span>
            
          

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
        
      
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2019/09/24/博客从-Octopress-迁移到-Hexo-经验总结/#comments" itemprop="discussionUrl"><span class="post-comments-count valine-comment-count" data-xid="/2019/09/24/博客从-Octopress-迁移到-Hexo-经验总结/" itemprop="commentCount"></span></a>
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="一、迁移过程"><a href="#一、迁移过程" class="headerlink" title="一、迁移过程"></a>一、迁移过程</h2><p>迁移过程网上有很多现成的文章，这里主要参考巧叔的 <a href="https://blog.devtang.com/2016/02/16/from-octopress-to-hexo/" target="_blank" rel="noopener">从 Octopress 迁移到 Hexo</a></p>
<h4 id="安装-Hexo"><a href="#安装-Hexo" class="headerlink" title="安装 Hexo"></a>安装 Hexo</h4><p>先使用以下命令安装 Hexo：</p>
<figure class="highlight zsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm install hexo-cli -g</span><br></pre></td></tr></table></figure>

<h4 id="创建新的博客目录"><a href="#创建新的博客目录" class="headerlink" title="创建新的博客目录"></a>创建新的博客目录</h4><figure class="highlight zsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ hexo init &lt;hexo root folder&gt;</span><br><span class="line">$ <span class="built_in">cd</span> &lt;hexo root folder&gt;</span><br><span class="line">$ npm install</span><br></pre></td></tr></table></figure>

<a id="more"></a>

<h4 id="迁移配置"><a href="#迁移配置" class="headerlink" title="迁移配置"></a>迁移配置</h4><ul>
<li>迁移文章</li>
</ul>
<p>把以前 Octopress 的 <code>source/_post</code> 目录下的文章，拷贝到 Hexo 的同名目录下即可。</p>
<ul>
<li>迁移图片资源</li>
</ul>
<p>以前的图片目录，也可以直接拷贝到 <code>source/images</code> 目录下。</p>
<ul>
<li>修改 _config.yml 文件</li>
</ul>
<p>上一步生成的 Hexo 目录里，_config.yml 都是默认值，可以根据自己需要修改。</p>
<h4 id="提交到远端仓库"><a href="#提交到远端仓库" class="headerlink" title="提交到远端仓库"></a>提交到远端仓库</h4><ul>
<li>clone Octopress source 仓库到本地</li>
</ul>
<p>远程仓库还是使用原来 github 和 gitcafe 上的仓库，所以我的做法是将原来 github 上的 source 分支仓库 clone 到本地：</p>
<figure class="highlight zsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ git <span class="built_in">clone</span> -b <span class="built_in">source</span> git@github.com:username/username.github.com.git hexo</span><br></pre></td></tr></table></figure>

<ul>
<li><p>将 hexo 目录里的文件都删除，当然除了 .git 目录外；</p>
</li>
<li><p>将 <hexo root folder> 目录里生成的东西全部拷贝到 hexo 目录；</hexo></p>
</li>
<li><p>强制推送到远端 <code>git push origin source -f</code></p>
</li>
</ul>
<p>到这里 Hexo 博客的 source 部分迁移完成，接下来就可以生成博客了。</p>
<h2 id="二、生成博客"><a href="#二、生成博客" class="headerlink" title="二、生成博客"></a>二、生成博客</h2><p>生成博客很简单，执行以下命令即可：</p>
<figure class="highlight zsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ hexo clean</span><br><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure>

<p>generate 命令会创建一个 public 目录（前面的 clean 命令会先删除这个目录，如果有），这个目录是实际的博客目录。</p>
<p>为了方便操作，生成博客并提交写了个 deploy 脚本：</p>
<figure class="highlight zsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#! /bin/zsh</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># git pull source</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************BEGIN GIT PULL SOURCE**************"</span></span><br><span class="line">git pull origin <span class="built_in">source</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [ $? != 0 ]</span><br><span class="line"><span class="keyword">then</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************GIT PULL SOURCE FAILED**************"</span></span><br><span class="line"><span class="built_in">exit</span> 1</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************GIT PULL SOURCE SUCCESS**************"</span></span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># hexo generate</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************BEGIN HEXO GENERATE**************"</span></span><br><span class="line">hexo clean</span><br><span class="line">hexo generate</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [ $? != 0 ]</span><br><span class="line"><span class="keyword">then</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************HEXO GENERATE FAILED**************"</span></span><br><span class="line"><span class="built_in">exit</span> 1</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************HEXO GENERATE SUCCESS**************"</span></span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># git push source</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************GIT PUSH BEGIN**************"</span></span><br><span class="line">git add --all .</span><br><span class="line">git commit -m <span class="string">"update at `date` "</span></span><br><span class="line">git push origin <span class="built_in">source</span></span><br><span class="line"><span class="keyword">if</span> [ $? != 0 ]</span><br><span class="line"><span class="keyword">then</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************GIT PUSH FAILED**************"</span></span><br><span class="line"><span class="built_in">exit</span> 1</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************GIT PUSH SUCCESS**************"</span></span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 创建发布用 git 仓库</span></span><br><span class="line"><span class="built_in">cd</span> public</span><br><span class="line">git init</span><br><span class="line">git add .</span><br><span class="line">git commit -m <span class="string">"update at `date` "</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 添加 coding.net 源</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************PUSH TO CODING.NET BEGIN**************"</span></span><br><span class="line"><span class="comment"># 改变 coding.net remote url</span></span><br><span class="line">git remote add coding git@git.coding.net:foogry/foogry.git &gt;&gt; /dev/null 2&gt;&amp;1</span><br><span class="line"><span class="comment"># 提交博客内容</span></span><br><span class="line">git push -u coding master:coding-pages -f</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [ $? != 0 ]</span><br><span class="line"><span class="keyword">then</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************PUSH TO CODING.NET FAILED**************"</span></span><br><span class="line"><span class="built_in">exit</span> 1</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************PUSH TO CODING.NET SUCCESS**************"</span></span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 添加 github 源</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************PUSH TO GITHUB BEGIN**************"</span></span><br><span class="line"><span class="comment"># 改变 github remote url</span></span><br><span class="line">git remote add origin git@github.com:wangzz/wangzz.github.com.git &gt;&gt; /dev/null 2&gt;&amp;1</span><br><span class="line"><span class="comment"># 提交博客内容</span></span><br><span class="line">git push origin master -f</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [ $? != 0 ]</span><br><span class="line"><span class="keyword">then</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************PUSH TO GITHUB FAILED**************"</span></span><br><span class="line"><span class="built_in">exit</span> 1</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************PUSH TO GITHUB SUCCESS**************"</span></span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">cd</span> -</span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"**************DONE**************"</span></span><br></pre></td></tr></table></figure>

<p>我把这个脚本放在了博客 souce 的根目录下每次修改完 source 后，执行一次，博客就能更新了。</p>
<h2 id="三、写新博客"><a href="#三、写新博客" class="headerlink" title="三、写新博客"></a>三、写新博客</h2><p>使用下述命令可以生成一个新的 markdown 文件：</p>
<figure class="highlight zsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new <span class="string">"文章标题"</span></span><br></pre></td></tr></table></figure>

<p>写完文章后执行前面的 deploy 脚本就行了。</p>
<h2 id="四、next-主题"><a href="#四、next-主题" class="headerlink" title="四、next 主题"></a>四、next 主题</h2><p>看了不少 Hexo 的主题，发现还是比较喜欢简洁的 <a href="https://theme-next.org/" target="_blank" rel="noopener">next</a>，目前在用其中的 <code>Pisces</code>。关于 next 主题的一些配置方式如下：</p>
<h4 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h4><p>其实就是将 next clone 到主题目录：</p>
<figure class="highlight zsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ git <span class="built_in">clone</span> git@github.com:iissnan/hexo-theme-next.git themes/next</span><br></pre></td></tr></table></figure>

<p>然后修改 Hexo 根目录下的 <code>_config.yml</code> 文件，将其中的主题设置成 next 即可：</p>
<figure class="highlight zsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Extensions</span></span><br><span class="line"><span class="comment">## Plugins: https://hexo.io/plugins/</span></span><br><span class="line"><span class="comment">## Themes: https://hexo.io/themes/</span></span><br><span class="line">theme: next</span><br></pre></td></tr></table></figure>

<h4 id="自定义-next"><a href="#自定义-next" class="headerlink" title="自定义 next"></a>自定义 next</h4><p>next 主题本身提供了比较高的自定义能力，具体配置文件为 themes/next/_config.yml ，可以根据个人喜好修改。</p>
<h4 id="增加-About-界面"><a href="#增加-About-界面" class="headerlink" title="增加 About 界面"></a>增加 About 界面</h4><ul>
<li>创建新的 About 界面：</li>
</ul>
<figure class="highlight zsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new page <span class="string">"about"</span></span><br></pre></td></tr></table></figure>

<ul>
<li><p>自定义新生成的 about.md 文件</p>
</li>
<li><p>修改 <code>themes/next/_config.yml</code> 文件，打开其中的 about 配置</p>
</li>
</ul>
<figure class="highlight zsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">menu:</span><br><span class="line">  home: / || home</span><br><span class="line">  <span class="comment">#tags: /tags/ || tags</span></span><br><span class="line">  <span class="comment">#categories: /categories/ || th</span></span><br><span class="line">  archives: /archives/ || archive</span><br><span class="line">  <span class="comment">#schedule: /schedule/ || calendar</span></span><br><span class="line">  <span class="comment">#sitemap: /sitemap.xml || sitemap</span></span><br><span class="line">  <span class="comment">#commonweal: /404/ || heartbeat</span></span><br><span class="line">  about: /about/ || user</span><br></pre></td></tr></table></figure>

<h4 id="添加谷歌广告"><a href="#添加谷歌广告" class="headerlink" title="添加谷歌广告"></a>添加谷歌广告</h4><p>将谷歌的广告脚本放到 <code>themes/next/layout/partials/head/head.swig</code> 中的任意一个位置即可</p>
<h4 id="添加百度统计"><a href="#添加百度统计" class="headerlink" title="添加百度统计"></a>添加百度统计</h4><p>将百度统计的 AppKey 放到 <code>themes/next/_confing.xml</code> 对应的配置中即可：</p>
<figure class="highlight zsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Baidu Analytics</span></span><br><span class="line">baidu_analytics: your appkey</span><br></pre></td></tr></table></figure>

<h2 id="五、在新电脑上配置已经存在的-Hexo-博客"><a href="#五、在新电脑上配置已经存在的-Hexo-博客" class="headerlink" title="五、在新电脑上配置已经存在的 Hexo 博客"></a>五、在新电脑上配置已经存在的 Hexo 博客</h2><h4 id="安装-Hexo-1"><a href="#安装-Hexo-1" class="headerlink" title="安装 Hexo"></a>安装 Hexo</h4><p>如果没安装过 Hexo，跟新建博客一样要先安装 ：</p>
<figure class="highlight zsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ npm install hexo-cli -g</span><br><span class="line">$ npm install hexo --save</span><br></pre></td></tr></table></figure>

<h4 id="clone-Hexo-source-到本地"><a href="#clone-Hexo-source-到本地" class="headerlink" title="clone Hexo source 到本地"></a>clone Hexo source 到本地</h4><figure class="highlight zsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ git <span class="built_in">clone</span> -b <span class="built_in">source</span> git@github.com:wangzz/wangzz.github.com.git hexo</span><br></pre></td></tr></table></figure>

<h4 id="部署博客"><a href="#部署博客" class="headerlink" title="部署博客"></a>部署博客</h4><p>进入到 hexo 的 source 目录，执行 deploy 脚本即可。</p>
<h4 id="SSH-key"><a href="#SSH-key" class="headerlink" title="SSH key"></a>SSH key</h4><p>clone source 或提交博客到 github 或 gitcafe 前，需要将将当前电脑上的 SSH key 填到 github 或 gitcafe 上，具体操作方式见之前的文章 <a href="http://foggry.com/2014/04/02/2014-04-02-ru-he-pei-zhi-rang-ni-de-octopressbo-ke-zai-duo-tai-macshang-tong-shi-shi-yong/" target="_blank" rel="noopener">《让Octopress博客在多台Mac上同时使用》</a></p>
<h2 id="参考文档"><a href="#参考文档" class="headerlink" title="参考文档"></a>参考文档</h2><ul>
<li><p><a href="https://blog.devtang.com/2016/02/16/from-octopress-to-hexo/" target="_blank" rel="noopener">从 Octopress 迁移到 Hexo</a></p>
</li>
<li><p><a href="[https://thief.one/2017/03/03/Hexo%E6%90%AD%E5%BB%BA%E5%8D%9A%E5%AE%A2%E6%95%99%E7%A8%8B/](https://thief.one/2017/03/03/Hexo搭建博客教程/)">Hexo搭建博客教程</a></p>
</li>
</ul>

    </div>

    
    
    
        
      
        <div id="reward-container">
  <div></div>
  <button id="reward-button" disable="enable" onclick="var qr = document.getElementById(&quot;qr&quot;); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
    打赏
  </button>
  <div id="qr" style="display: none;">
        
      
      <div style="display: inline-block">
        <img src="/images/weixinpay.jpg" alt="foogry 微信支付">
        <p>微信支付</p>
      </div>

  </div>
</div>

      
        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>foogry</li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="http://foogry.org/2019/09/24/博客从-Octopress-迁移到-Hexo-经验总结/" title="Octopress 迁移 Hexo 经验总结">http://foogry.org/2019/09/24/博客从-Octopress-迁移到-Hexo-经验总结/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/deed.zh" rel="noopener" target="_blank"><i class="fa fa-fw fa-creative-commons"></i>BY-NC-ND</a> 许可协议。转载请注明出处！</li>
</ul>
</div>

      

      <footer class="post-footer">
          
            
          
          <div class="post-tags">
            
              <a href="/tags/Octopress/" rel="tag"># Octopress</a>
            
              <a href="/tags/hexo/" rel="tag"># hexo</a>
            
          </div>
        

        

          <div class="post-nav">
            <div class="post-nav-next post-nav-item">
              
                <a href="/2019/09/18/2019-09-18-ios-ding-wei-quan-xian-na-xie-shi/" rel="next" title="iOS 定位权限那些事">
                  <i class="fa fa-chevron-left"></i> iOS 定位权限那些事
                </a>
              
            </div>

            <span class="post-nav-divider"></span>

            <div class="post-nav-prev post-nav-item">
              
            </div>
          </div>
        
      </footer>
    
  </div>
  
  
  
  </article>

  </div>


          </div>
          
    
    <div class="comments" id="comments"></div>
  

        </div>
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">
        
        
        
        
      

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#一、迁移过程"><span class="nav-number">1.</span> <span class="nav-text">一、迁移过程</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#安装-Hexo"><span class="nav-number">1.0.1.</span> <span class="nav-text">安装 Hexo</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#创建新的博客目录"><span class="nav-number">1.0.2.</span> <span class="nav-text">创建新的博客目录</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#迁移配置"><span class="nav-number">1.0.3.</span> <span class="nav-text">迁移配置</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#提交到远端仓库"><span class="nav-number">1.0.4.</span> <span class="nav-text">提交到远端仓库</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#二、生成博客"><span class="nav-number">2.</span> <span class="nav-text">二、生成博客</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#三、写新博客"><span class="nav-number">3.</span> <span class="nav-text">三、写新博客</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#四、next-主题"><span class="nav-number">4.</span> <span class="nav-text">四、next 主题</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#安装"><span class="nav-number">4.0.1.</span> <span class="nav-text">安装</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#自定义-next"><span class="nav-number">4.0.2.</span> <span class="nav-text">自定义 next</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#增加-About-界面"><span class="nav-number">4.0.3.</span> <span class="nav-text">增加 About 界面</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#添加谷歌广告"><span class="nav-number">4.0.4.</span> <span class="nav-text">添加谷歌广告</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#添加百度统计"><span class="nav-number">4.0.5.</span> <span class="nav-text">添加百度统计</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#五、在新电脑上配置已经存在的-Hexo-博客"><span class="nav-number">5.</span> <span class="nav-text">五、在新电脑上配置已经存在的 Hexo 博客</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#安装-Hexo-1"><span class="nav-number">5.0.1.</span> <span class="nav-text">安装 Hexo</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#clone-Hexo-source-到本地"><span class="nav-number">5.0.2.</span> <span class="nav-text">clone Hexo source 到本地</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#部署博客"><span class="nav-number">5.0.3.</span> <span class="nav-text">部署博客</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#SSH-key"><span class="nav-number">5.0.4.</span> <span class="nav-text">SSH key</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#参考文档"><span class="nav-number">6.</span> <span class="nav-text">参考文档</span></a></li></ol></div>
        
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">foogry</p>
  <div class="site-description" itemprop="description"></div>
</div>
  <nav class="site-state motion-element">
      <div class="site-state-item site-state-posts">
        
          <a href="/archives/">
        
          <span class="site-state-item-count">22</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
    
      
      
      <div class="site-state-item site-state-categories">
        
        <span class="site-state-item-count">8</span>
        <span class="site-state-item-name">分类</span>
        
      </div>
    
      
      
      <div class="site-state-item site-state-tags">
        
        <span class="site-state-item-count">56</span>
        <span class="site-state-item-name">标签</span>
        
      </div>
    
  </nav>
  <div class="cc-license motion-element" itemprop="license">
    
  
    <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/deed.zh" class="cc-opacity" rel="noopener" target="_blank"><img src="/images/cc-by-nc-nd.svg" alt="Creative Commons"></a>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">foogry</span>
</div>
  <div class="powered-by">Hosted by <a href="https://coding.net/pages" class="theme-link" rel="noopener" target="_blank">Coding Pages</a></div>
  <span class="post-meta-divider">|</span>
  <div class="powered-by">由 <a href="https://hexo.io" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v3.9.0</div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">主题 – <a href="https://theme-next.org" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> v7.4.0</div>

        












        
      </div>
    </footer>
  </div>

  


  <script src="/lib/anime.min.js?v=3.1.0"></script>
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script src="/js/utils.js?v=7.4.0"></script><script src="/js/motion.js?v=7.4.0"></script>
<script src="/js/schemes/pisces.js?v=7.4.0"></script>
<script src="/js/next-boot.js?v=7.4.0"></script>



  





















  

  

  


<script>
NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
  var GUEST = ['nick', 'mail', 'link'];
  var guest = 'nick,mail,link';
  guest = guest.split(',').filter(item => {
    return GUEST.includes(item);
  });
  new Valine({
    el: '#comments',
    verify: false,
    notify: false,
    appId: 'vqsvFaA8FXndr4867HJvtJ7P-gzGzoHsz',
    appKey: '6L6ddsrLCJVMetc2W7CL9kkf',
    placeholder: 'Comment Here',
    avatar: 'mm',
    meta: guest,
    pageSize: '10' || 10,
    visitor: false,
    lang: 'zh-cn' || 'zh-cn',
    path: location.pathname
  });
}, window.Valine);
</script>

</body>
</html>
